package com.blog.util;

import java.io.UnsupportedEncodingException;

public class StringUtil {
	public static byte[] StringToByteArr(String souString){
		if(souString == null){
			return null;
		}else{
			try {
				return souString.getBytes("UTF-8");
			} catch (UnsupportedEncodingException e) {
				
				e.printStackTrace();
				return null;
			}
		}
	}
	
    public static String replaceHTML(String str){
		String s1=str.replaceAll("</?[^>]+>", "");
		s1=s1.replaceAll("\\&nbsp;", " ");
		s1=s1.replaceAll("\\&lt;", "<");
		s1=s1.replaceAll("\\&gt;", ">");
		s1=s1.replaceAll("\\&mdash;", "");
		s1=s1.replaceAll("\\&deg;", "");
		s1=s1.replaceAll("\\&ldquo;", "");
		s1=s1.replaceAll("\\&rdquo;", "");
		s1=s1.replaceAll("\\&middot;", "");
		s1=s1.replaceAll("\\&lsquo;", "‘");
		s1=s1.replaceAll("\\&rsquo;", "’");
		s1=s1.replaceAll("\\&hellip;", "…");
		return s1;
	}

}
